using System;

namespace ErrorDumper.Handlers {
    public class ConsoleExceptionHandler : IExceptionHandler {
        public string HandleException(ExceptionPropertyCollection properties, Exception exception) {
            Console.Write("EXCEPTION > UTC=" + DateTime.UtcNow.ToString() + " > ");
            if (properties != null && properties.Count > 0)
                foreach (var h in properties)
                    Console.Write(h.Key + "=" + h.Value + "; ");
            if (exception != null)
                Console.Write("\r\n" + exception.ToString());
            Console.WriteLine();
            return null;
        }

        public string HandleException(ExceptionPropertyCollection properties, string content) {
            Console.Write("EXCEPTION > UTC=" + DateTime.UtcNow.ToString() + " > ");
            if (properties != null && properties.Count > 0)
                foreach (var h in properties)
                    Console.Write(h.Key + "=" + h.Value + "; ");
            Console.Write("\r\n" + content + "\r\n");
            return null;
        }
    }
}
